#include "LutController.h"
#include "MainWindow.h"
#include <QtDebug>

LutController *LutController::instance = 0;

LutController::LutController()
{
	users = new UserList(this);
	window = new MainWindow();
}

LutController* LutController::getInstance()
{
	if(!instance)
		instance = new LutController();
;
	return instance;
}

void LutController::startApp()
{
	window->initMainWindow();
	window->show();
}

bool LutController::getShowTime()
{
	return window->getShowTime();
}

int LutController::myId()
{
	return window->myId();
}

QString LutController::getNameFromId(int id)
{
	return users->getNameById(id);
}

void LutController::sendMsg(QString str)
{
	window->sendMsg(str);
}

void LutController::sendPrivateMsg(int to, QString str)
{
	window->sendPrivateMsg(to, str);
}

void LutController::onQuitReq()
{
	emit quitMe();
}

UserList* LutController::getUsers()
{
	return users;
}
